Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix overflow when texture size is smaller than block size #3501

Closed
wants to merge 1 commit into from

Conversation

eranzhao
Copy link

@eranzhao eranzhao commented Dec 11, 2024

If the texture size is smaller than the block size, it can cause an overflow. For example, a texture with size of 4x4 but format is ASTC 6x6.

@eranzhao eranzhao closed this Dec 11, 2024
@cmannett85-arm
Copy link
Collaborator

cmannett85-arm commented Dec 11, 2024

Hi @eranzhao, the ASTC spec requires that the data must be an integer of the block size, so even if the image dimensions are smaller than the block, the underlying data must be block aligned. What prompted this PR? Are you seeing a particular error?

@baldurk
Copy link
Owner

baldurk commented Dec 11, 2024

Please also stop opening and closing PRs with no notice. There is nothing that requires re-creating a PR, if you need to fix any commits on the branch you can do so by force pushing.

@eranzhao
Copy link
Author

是的,我们在使用UE4的时候,贴图可以指定ASTC 6x6的格式,然后部分贴图的尺寸是4x4的,这个在renderdoc启动抓帧的时候,产生了溢出。造成的后果就是写坏了内存,在后续使用内存的时候,造成了崩溃。

Yes, when using UE4, we specified the ASTC 6x6 format for textures, but some textures were sized at 4x4. This caused an overflow when capturing frames with RenderDoc, resulting in memory corruption. Consequently, this led to crashes during subsequent memory usage.

以下是错误的信息:

The following is the wrong message:

image
image

但是这个错误是可以忽略的,原因在前面。

But this error can be ignored for the reasons mentioned above.

我尝试修改源码定位这个问题,输出一些数据:

I tried to modify the source code to locate this problem and output some data:

27d68355461bf0ddf3a775949a3310b

我很认同你所说的数据必须对齐的观点,但是我目前还不能完全确定产生这个问题的根本原因。我关闭了这个PR是因为,虽然我通过了前段的问题,但是仍然有新的问题产生。当我搞清楚其他的问题的时候,我希望提交一个新的PR,来修复这个问题。

I agree with your point that the data must be aligned, but I'm not entirely sure yet what the root cause of this problem is. I closed this PR because, although I passed the previous questions, new questions still arise. When I figure out the other issues, I hope to submit a new PR to fix this issue.

@eranzhao
Copy link
Author

Please also stop opening and closing PRs with no notice. There is nothing that requires re-creating a PR, if you need to fix any commits on the branch you can do so by force pushing.

抱歉造成了困扰,我将再努力下。

Sorry for the trouble, I will try harder.

If the texture size is smaller than the block size, it can cause an overflow. For example, a texture size of 4x4 with a format of ASTC 6x6.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants